import Vue from 'vue'
import axios from '@/libs/api.request'
import Url from '@/tool/Url'
import Viewer from 'v-viewer'
import 'viewerjs/dist/viewer.css'
Vue.use(Viewer)
Viewer.setDefaults({
    navbar: false, //底部缩略图
    toolbar: false, //底部工具栏
    button: false, //右上角按钮
    title: false, //当前图片标题
    movable: true, //是否可以移动
    zoomable: true, //是否可以缩放
    transition: false //使用 CSS3 过度
})

//七牛信息
export const getQiniu = (data) => {
    return axios.request({
        url: 'qiniu/get-token',
        method: 'post',
        data
    })
}

//首页表单类型列表
export const homeFormTypeList = data => {
    return axios.request({
        url: '/backend/home/form-type-list',
        method: 'post',
        data
    })
}

//首页表单类型列表
export const homeData = data => {
    return axios.request({
        url: '/backend/home/home-data',
        method: 'post',
        data
    })
}

//首页表单类型列表
export const userChartsData = data => {
    return axios.request({
        url: '/backend/home/user-charts-data',
        method: 'post',
        data
    })
}

//首页表单类型列表
export const orderChartsData = data => {
    return axios.request({
        url: '/backend/home/order-charts-data',
        method: 'post',
        data
    })
}

//城市列表(筛选项)
export const cityListForSelect = data => {
    return axios.request({
        url: '/backend/area/three-city-list',
        method: 'post',
        data
    })
}

//发送验证码
export const sendCode = data => {
    return axios.request({
        url: '/backend/phone/send-code',
        method: 'post',
        data
    })
}

//验证验证码是否正确
export const checkCode = data => {
    return axios.request({
        url: '/backend/phone/check-code',
        method: 'post',
        data
    })
}

//系统设置
export const setting = data => {
    return axios.request({
        url: '/backend/setting/set',
        method: 'post',
        data
    })
}

//系统信息
export const getSettingInfo = data => {
    return axios.request({
        url: '/backend/setting/get-setting-info',
        method: 'post',
        data
    })
}

//用户列表
export const getUserList = data => {
    return axios.request({
        url: '/backend/user/user-list',
        method: 'post',
        data
    })
}

//修改用户身份
export const changeUserIdentity = data => {
    return axios.request({
        url: '/backend/user/change-user-identity',
        method: 'post',
        data
    })
}

//修改用户状态
export const changeMemberStatus = data => {
    return axios.request({
        url: '/backend/user/change-user-status',
        method: 'post',
        data
    })
}

//设置管理绑定的推送表单
export const setAdminForm = data => {
    return axios.request({
        url: '/backend/user/set-admin-form',
        method: 'post',
        data
    })
}

//维修队列表筛选项
export const repairListForSelect = data => {
    return axios.request({
        url: '/backend/repair/list-for-select',
        method: 'post',
        data
    })
}

//任务列表
export const taskList = data => {
    return axios.request({
        url: '/backend/repair/task-list',
        method: 'post',
        data
    })
}

//修改任务状态
export const changeTaskStatus = data => {
    return axios.request({
        url: '/backend/repair/change-task-status',
        method: 'post',
        data
    })
}

//企业认证列表
export const getUserAuthList = data => {
    return axios.request({
        url: '/backend/user/user-auth-list',
        method: 'post',
        data
    })
}

//审核企业认证
export const userAuthAudit = data => {
    return axios.request({
        url: '/backend/user/audit-user-auth',
        method: 'post',
        data
    })
}

//修改企业认证信息
export const editUserAuth = data => {
    return axios.request({
        url: '/backend/user/edit-user-auth',
        method: 'post',
        data
    })
}

//修改企业认证状态
export const changeUserAuthStatus = data => {
    return axios.request({
        url: '/backend/user/change-user-auth-status',
        method: 'post',
        data
    })
}

//维修队列表
export const repairList = data => {
    return axios.request({
        url: '/backend/repair/repair-list',
        method: 'post',
        data
    })
}

//创建/编辑维修队
export const editRepair = data => {
    return axios.request({
        url: '/backend/repair/edit-repair',
        method: 'post',
        data
    })
}

//维修队队员列表
export const repairUserList = data => {
    return axios.request({
        url: '/backend/repair/repair-user-list',
        method: 'post',
        data
    })
}

//抢修订单列表
export const taskRepairList = data => {
    return axios.request({
        url: '/backend/repair/task-repair-list',
        method: 'post',
        data
    })
}

//修改抢修订单状态
export const changeTaskRepairStatus = data => {
    return axios.request({
        url: '/backend/repair/change-task-repair-status',
        method: 'post',
        data
    })
}

//取消抢修订单
export const cancelTaskRepair = data => {
    return axios.request({
        url: '/backend/repair/cancel-task-repair',
        method: 'post',
        data
    })
}

//派单
export const assignTaskRepair = data => {
    return axios.request({
        url: '/backend/repair/assign-task-repair',
        method: 'post',
        data
    })
}

//修改派单
export const changeRepairUser = data => {
    return axios.request({
        url: '/backend/repair/change-repair-user',
        method: 'post',
        data
    })
}

//所有抢修员
export const repairUserListForSelect = data => {
    return axios.request({
        url: '/backend/repair/repair-user-list-for-select',
        method: 'post',
        data
    })
}

//任务指派选择抢修员
export const repairUserListForAssign = data => {
    return axios.request({
        url: '/backend/repair/repair-user-list-for-assign',
        method: 'post',
        data
    })
}

//抢修订单详情
export const taskRepairDetail = data => {
    return axios.request({
        url: '/backend/repair/task-repair-detail',
        method: 'post',
        data
    })
}

//设备/故障列表
export const deviceList = data => {
    return axios.request({
        url: '/backend/device/device-list',
        method: 'post',
        data
    })
}

//创建/编辑设备/故障
export const editDevice = data => {
    return axios.request({
        url: '/backend/device/edit-device',
        method: 'post',
        data
    })
}

//修改设备/故障状态
export const changeDeviceStatus = data => {
    return axios.request({
        url: '/backend/device/change-device-status',
        method: 'post',
        data
    })
}

//抢修队评价列表
export const repairEvaluateList = data => {
    return axios.request({
        url: '/backend/repair/repair-evaluate-list',
        method: 'post',
        data
    })
}

//删除抢修队评价
export const changeRepairEvaluateStatus = data => {
    return axios.request({
        url: '/backend/repair/change-repair-evaluate-status',
        method: 'post',
        data
    })
}

//意见反馈
export const feedBackList = data => {
    return axios.request({
        url: '/backend/feed-back/list',
        method: 'post',
        data
    })
}

//修改意见反馈状态
export const changeFeedStatus = data => {
    return axios.request({
        url: '/backend/feed-back/change-feed-status',
        method: 'post',
        data
    })
}

//广告位列表
export const adPositionList = data => {
    return axios.request({
        url: '/backend/ad/ad-position-list',
        method: 'post',
        data
    })
}

//广告位列表(筛选项)
export const adPositionListForSelect = data => {
    return axios.request({
        url: '/backend/ad/ad-position-list-for-select',
        method: 'post',
        data
    })
}

//更改广告位信息
export const editAdPosition = data => {
    return axios.request({
        url: '/backend/ad/edit-ad-position',
        method: 'post',
        data
    })
}

//修改广告位信息
export const changeAdPositionStatus = data => {
    return axios.request({
        url: '/backend/ad/change-ad-position-status',
        method: 'post',
        data
    })
}

//广告列表
export const adList = data => {
    return axios.request({
        url: '/backend/ad/ad-list',
        method: 'post',
        data
    })
}

//更改广告信息
export const editAd = data => {
    return axios.request({
        url: '/backend/ad/edit-ad',
        method: 'post',
        data
    })
}

//修改广告信息
export const changeAdStatus = data => {
    return axios.request({
        url: '/backend/ad/change-ad-status',
        method: 'post',
        data
    })
}

//品类列表
export const cateList = data => {
    return axios.request({
        url: '/backend/cate/cate-list',
        method: 'post',
        data
    })
}

//更改品类信息
export const editCate = data => {
    return axios.request({
        url: '/backend/cate/edit-cate',
        method: 'post',
        data
    })
}

//修改品类状态
export const changeCateStatus = data => {
    return axios.request({
        url: '/backend/cate/change-cate-status',
        method: 'post',
        data
    })
}

//品类列表(筛选项)
export const cateListForSelect = data => {
    return axios.request({
        url: '/backend/cate/list-for-select',
        method: 'post',
        data
    })
}

//资讯列表
export const articleList = data => {
    return axios.request({
        url: '/backend/article/article-list',
        method: 'post',
        data
    })
}

//更改资讯信息
export const editArticle = data => {
    return axios.request({
        url: '/backend/article/edit-article',
        method: 'post',
        data
    })
}

//修改资讯状态
export const changeArticleStatus = data => {
    return axios.request({
        url: '/backend/article/change-article-status',
        method: 'post',
        data
    })
}

//规格/规格品类列表
export const specsList = data => {
    return axios.request({
        url: '/backend/good/specs-list',
        method: 'post',
        data
    })
}

//更改规格/规格品类
export const editSpecs = data => {
    return axios.request({
        url: '/backend/good/edit-specs',
        method: 'post',
        data
    })
}

//修改规格/规格品类状态
export const changeSpecsStatus = data => {
    return axios.request({
        url: '/backend/good/change-specs-status',
        method: 'post',
        data
    })
}

//规格/规格品类筛选项
export const specsListForSelect = data => {
    return axios.request({
        url: '/backend/good/specs-list-for-select',
        method: 'post',
        data
    })
}

//商品列表
export const goodList = data => {
    return axios.request({
        url: '/backend/good/good-list',
        method: 'post',
        data
    })
}

//商品详情
export const goodDetail = data => {
    return axios.request({
        url: '/backend/good/good-detail',
        method: 'post',
        data
    })
}

//更改商品信息
export const editGood = data => {
    return axios.request({
        url: '/backend/good/edit-good',
        method: 'post',
        data
    })
}

//更改商品状态
export const changeGoodStatus = data => {
    return axios.request({
        url: '/backend/good/change-good-status',
        method: 'post',
        data
    })
}

//审核三方发布的商品
export const auditGood = data => {
    return axios.request({
        url: '/backend/good/audit-good',
        method: 'post',
        data
    })
}

//商品列表(筛选)
export const goodListForSelect = data => {
    return axios.request({
        url: '/backend/good/list-for-select',
        method: 'post',
        data
    })
}

//商品价格计算
export const getGoodPriceList = data => {
    return axios.request({
        url: '/backend/good/good-price-list',
        method: 'post',
        data
    })
}

//订单列表
export const orderList = data => {
    return axios.request({
        url: '/backend/order/order-list',
        method: 'post',
        data
    })
}

//订单详情
export const orderInfo = data => {
    return axios.request({
        url: '/backend/order/order-info',
        method: 'post',
        data
    })
}

//订单编辑
export const editOrder = data => {
    return axios.request({
        url: '/backend/order/edit-order',
        method: 'post',
        data
    })
}

//订单发货
export const sendOrder = data => {
    return axios.request({
        url: '/backend/order/send-order',
        method: 'post',
        data
    })
}

//订单交易成功
export const orderSuccess = data => {
    return axios.request({
        url: '/backend/order/order-success',
        method: 'post',
        data
    })
}

//修改订单订单状态
export const changeOrderStatus = data => {
    return axios.request({
        url: '/backend/order/change-order-status',
        method: 'post',
        data
    })
}

//线下订单列表
export const offlineOrderList = data => {
    return axios.request({
        url: '/backend/order/offline-order-list',
        method: 'post',
        data
    })
}

//新增/编辑线下订单
export const editOfflineOrder = data => {
    return axios.request({
        url: '/backend/order/edit-offline-order',
        method: 'post',
        data
    })
}

//线下订单列表
export const changeOfflineOrderStatus = data => {
    return axios.request({
        url: '/backend/order/change-offline-order-status',
        method: 'post',
        data
    })
}

//合同列表
export const contractList = data => {
    return axios.request({
        url: '/backend/contract/contract-list',
        method: 'post',
        data
    })
}

//编辑列表
export const editContract = data => {
    return axios.request({
        url: '/backend/contract/edit-contract',
        method: 'post',
        data
    })
}

//修改合同状态
export const changeContractStatus = data => {
    return axios.request({
        url: '/backend/contract/change-contract-status',
        method: 'post',
        data
    })
}

//管理员手机号列表
export const getAdminPhoneList = data => {
    return axios.request({
        url: '/backend/contract/admin-list',
        method: 'post',
        data
    })
}

//用户地址列表
export const userAddressList = data => {
    return axios.request({
        url: '/backend/user/user-address-list',
        method: 'post',
        data
    })
}

//修改用户地址信息
export const editAddress = data => {
    return axios.request({
        url: '/backend/user/edit-address',
        method: 'post',
        data
    })
}

//施工单位列表
export const companyList = data => {
    return axios.request({
        url: '/backend/form/company-list',
        method: 'post',
        data
    })
}

//更改施工单位信息
export const editCompany = data => {
    return axios.request({
        url: '/backend/form/edit-company',
        method: 'post',
        data
    })
}

//更改施工单位状态
export const changeCompanyStatus = data => {
    return axios.request({
        url: '/backend/form/change-company-status',
        method: 'post',
        data
    })
}

//委托单位列表
export const companyWtList = data => {
    return axios.request({
        url: '/backend/company/company-wt-list',
        method: 'post',
        data
    })
}

//更改委托单位信息
export const editCompanyWt = data => {
    return axios.request({
        url: '/backend/company/edit-company-wt',
        method: 'post',
        data
    })
}

//更改委托单位状态
export const changeCompanyWtStatus = data => {
    return axios.request({
        url: '/backend/company/change-company-wt-status',
        method: 'post',
        data
    })
}

//表单类型列表筛选项
export const formTypeListForSelect = data => {
    return axios.request({
        url: '/backend/form/form-type-list-for-select',
        method: 'post',
        data
    })
}

//施工单位属性列表筛选项
export const companyTagListForSelect = data => {
    return axios.request({
        url: '/backend/form/company-tag-list-for-select',
        method: 'post',
        data
    })
}

//表单类型列表
export const formTypeList = data => {
    return axios.request({
        url: '/backend/form/form-type-list',
        method: 'post',
        data
    })
}

//编辑表单类型
export const editFormType = data => {
    return axios.request({
        url: '/backend/form/edit-form-type',
        method: 'post',
        data
    })
}

//表单信息列表
export const formList = data => {
    return axios.request({
        url: '/backend/form/form-list',
        method: 'post',
        data
    })
}

//表单信息标注处理
export const readForm = data => {
    return axios.request({
        url: '/backend/form/read-form',
        method: 'post',
        data
    })
}

//删除表单信息
export const changeFormStatus = data => {
    return axios.request({
        url: '/backend/form/change-form-status',
        method: 'post',
        data
    })
}

// 角色列表
export const roleList = data => {
    let url = Url.getPath('/backend/role/role-list', data)
    return axios.request({
        url: url,
        method: 'get',
    })
}

// 创建角色
export const createRole = data => {
    return axios.request({
        url: '/backend/role/create-role',
        method: 'post',
        data
    })
}

// 更新角色
export const updateRole = data => {
    return axios.request({
        url: '/backend/role/update-role',
        method: 'post',
        data
    })
}

// 删除角色
export const deleteRole = data => {
    return axios.request({
        url: '/backend/role/delete-role',
        method: 'post',
        data
    })
}

// 角色详情
export const getRoleInfo = data => {
    return axios.request({
        url: '/backend/role/role-info',
        method: 'post',
        data
    })
}

// 创建角色选择权限列表
export const getAuthList = data => {
    let url = 'backend/permission/select-data'
    return axios.request({
        url: url,
        method: 'get'
    })
}

// 权限列表
export const authList = data => {
    let url = Url.getPath('/backend/permission/auth-list', data)
    return axios.request({
        url: url,
        method: 'get',
    })
}

// 权限角色
export const createAuth = data => {
    return axios.request({
        url: '/backend/permission/create-auth',
        method: 'post',
        data
    })
}

// 删除权限
export const deleteAuth = data => {
    return axios.request({
        url: '/backend/permission/delete-auth',
        method: 'post',
        data
    })
}

// 根据角色获取权限
export const getRoleAuth = data => {
    return axios.request({
        url: '/backend/permission/get-role-auth',
        method: 'post',
        data
    })
}

//管理员列表
export const getAdminList = data => {
    return axios.request({
        url: '/backend/user/admin-list',
        method: 'post',
        data
    })
}

//管理员列表
export const changeUserStatus = data => {
    return axios.request({
        url: '/backend/user/change-user-status',
        method: 'post',
        data
    })
}

//添加编辑管理员
export const createAdmin = data => {
    return axios.request({
        url: 'backend/user/edit-admin',
        method: 'post',
        data
    })
}


//修改密码
export const modifyPassword = data => {
    return axios.request({
        url: 'backend/user/modify-password',
        method: 'post',
        data
    })
}